<?php
pcntl_signal(SIGINT,function($signo){

    fprintf(STDOUT,"pid=%d 接收到了信号:%d\n",getmypid(),$signo);
});
$sigset = [SIGINT,SIGUSR1];
pcntl_sigprocmask(SIG_BLOCK,$sigset);
$i=10;
while ($i--){
    pcntl_signal_dispatch();
    fprintf(STDOUT,"pid=%d do something...\n",getmypid());
    sleep(1);
    if ($i==5){
        fprintf(STDOUT,"时间到，准备解除阻塞...\n");
        pcntl_sigprocmask(SIG_UNBLOCK,[SIGINT,SIGUSR1],$oldset);
        print_r($oldset);
    }
}